<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增项目')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-user-add" class="form-horizontal">
        <input name="deptId" type="hidden" id="treeId"/>
<!--        <h4 class="form-header h4">基本信息</h4>-->
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">车间班组id：</label>
                    <div class="col-sm-8">
                        <input name="classgroupNumber" placeholder="请输入车间班组id" autocomplete="off" class="form-control" type="text" maxlength="30"
                               required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">车间班次名称：</label>
                    <div class="col-sm-8">
                        <input name="classgroupName" placeholder="请输入车间班次名称" class="form-control"autocomplete="off" type="text" maxlength="30"
                               >
                    </div>
                </div>
            </div>

        </div>
        <div class="row">

            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">交班时间：</label>
                    <div class="col-sm-8">
                       <input type="text" class="form-control" placeholder="请单击选择交班时间：" name="shiftTime" id="startTime"/>

                        <!--<span class="input-group-addon"><i class="fa fa-taxi"></i></span>-->
                        <!--<input class="form-control" type="text" name="deptName" onclick="selectDeptTree()"
                               placeholder="请选择部门"
                               id="treeName">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>-->
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">接班时间：</label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" placeholder="请单击选择接班时间：" name="sussessionTime" id="finishTime"/>
                    </div>
                </div>
            </div>

        </div>
        <div class="row">

            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">用户id：</label>
                    <div class="col-sm-8">
                        <input id="userId" name="userId"class="form-control" placeholder="请输入用户id"autocomplete="off"  type="text"
                               maxlength="30" >
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">车间上一班次id：</label>
                    <div class="col-sm-8">
                        <input id="lastClassgroupNumber" name="lastClassgroupNumber"class="form-control" placeholder="请输入车间上一班次id"autocomplete="off"  type="text"
                               maxlength="30" >
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">车间上一班次名称：</label>
                    <div class="col-sm-8">
                        <input id="lastClassgroupName" name="lastClassgroupName"class="form-control" placeholder="请输入车间上一班次名称"autocomplete="off"  type="text"
                               maxlength="30" >
                    </div>
                </div>
            </div>

        </div>


        <!--<h4 class="form-header h4">其他信息</h4>-->
        <!--<div class="row">-->
            <!--<div class="col-sm-12">-->
                <!--<div class="form-group">-->
                    <!--<label class="col-xs-2 control-label">项目描述：</label>-->
                    <!--<div class="col-xs-10">-->
                        <!--<textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->


    </form>
</div>

<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存
        </button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭
        </button>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script>
    var prefix = ctx + "bas/workshopChangeRd";
    layui.use('laydate', function(){
        var laydates = layui.laydate;
        laydates.render({
            elem: '#startTime'
            ,type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })

    layui.use('laydate', function(){
        var laydates = layui.laydate;
        laydates.render({
            elem: '#finishTime'
            ,type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })
    var ItemCodeInfoDlg = {
        data: {
            deptId: ""
        }
    };

    //项目保存
    function submitHandler() {
        var password = $("#password").val();
        if ($.validate.form()) {
            var data = $("#form-user-add").serializeArray();
            $.operate.saveTab(prefix + "/add", data);
        }
    }


    /* 选择部门树 */
    function selectDeptTree() {
        var deptId = $.common.isEmpty($("#treeId").val()) ? "1" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        selectgroup();
        layer.close(index);
    }

    //分配项目组
    function selectgroup() {
        var deptId = $("#treeId").val();
        var url = ctx + "system/item/selectPrjgroupByDeptId/" + deptId;
        $.get(url, function (result) {
            var html = ""
            for (var i = 0; i < result.length; i++) {
                html += "<option  value=" + result[i].prjgroupId + ">" + result[i].prjgroupName + "</option>"
            }
            $("#prjGroup").html(html)
            console.log(result)
        })

    }
    //分配项目参与人员
    /*function selectelopy() {
        var deptId = $("#treeId").val();
        var url = ctx + "system/item/selectEmployeeByDeptId/" + deptId;
        $.get(url, function (result) {
            console.log(result)
            var html = ""
            for (var i = 0; i < result.length; i++) {
                html += "<option  value=" + result[i].employeeId + ">" + result[i].name + "</option>"
            }
            $("#emplyIds").html(html)
            console.log(result)
        })

    }*/
</script>
</body>
</html>